#!/bin/bash

set -e

if [[ $1 = "add" ]]
then
  if [[ $2 = "raw" ]]
  then
    time python -m build_django --dir "./tests/test_projects/$(openssl rand -hex 20)" "${@:3}" test_proect
  fi

  if [[ $2 = "" ]]
  then
    time python -m build_django --dir "./tests/test_projects/$(openssl rand -hex 20)" --git --commit --debug --migrate --no-compile --use-ssl --commit-message "Test commit" --email "test@example.com" --username "Kapustlo"  test_project
  fi
elif [[ $1 = "clear" ]]
then
  rm -rfvd ./tests/test_projects/*
  
  echo "*" > ./tests/test_projects/.gitignore

  echo "!.gitignore" >> ./tests/test_projects/.gitignore
fi
